home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / ICNDRW_1.ARJ / TESTICON.PAS < prev    next >
Pascal/Delphi Source File  |  1991-08-16  |  2KB  |  80 lines

  1. {---------------------------------------------------------------------
  2.    Test Icon
  3.  
  4.    Copyright (c) 1991 - SofDesign Technology
  5.    All Rights Reserved
  6.  
  7.    This program display a bunch of icons.  To use, type
  8.  
  9.    TESTICON <libname> iconname
  10.  
  11.    if you don't specify a libname, then an iconname is assumed.
  12.  
  13.    note:  you must use the extensions like such:
  14.  
  15.           TESTICON icon.lib test.icn
  16.  
  17. ----------------------------------------------------------------------}
  18. Program Test_Icon;
  19.  
  20. {$X+}
  21. {$G+}
  22. {$R-}
  23. {$S-}
  24.  
  25. uses crt,bgidriv,graph,icontool;
  26. const
  27.   maxicons=255; { we'll load 400 of them.  Change this for more. }
  28.  
  29. var
  30.   anicon : array[1..maxicons] of icon;
  31.  
  32. {$I grafinit.pas}
  33.  
  34. procedure main;
  35. var i:integer;
  36. begin
  37.   randomize;
  38.   if paramcount=0 then
  39.   begin
  40.     writeln('Well, what should I do?');
  41.     halt(255);
  42.   end;
  43.   if paramcount=1 then
  44.     anicon[1].init('',paramstr(1),1,1)
  45.   else
  46.   if paramcount>1 then
  47.     anicon[1].init(paramstr(1),paramstr(2),1,1);
  48.   if anicon[1].initerror then
  49.   begin
  50.     writeln('Oops, an error!');
  51.     halt(1);
  52.   end;
  53.   anicon[1].setput(copyput);
  54.   anicon[1].icontitle(false);
  55.   for i:=2 to maxicons do
  56.     anicon[i]:=anicon[1];
  57.   for i:=1 to maxicons do
  58.   begin
  59.     anicon[i].setxy(random(getmaxx)+1,random(getmaxy)+1);
  60.     anicon[i].showicon;
  61.   end;
  62.   repeat
  63.     for i:= maxicons downto 1 do
  64.       anicon[i].hideicon;
  65.     for i:=1 to maxicons do
  66.     begin
  67.       anicon[i].setxy(random(getmaxx)+1,random(getmaxy)+1);
  68.       anicon[i].showicon;
  69.     end;
  70.     delay(100);  { slight delay so you can view the icons }
  71.   until keypressed;
  72.   anicon[1].disposeicon;
  73.   closegraph;
  74.   restorecrtmode;
  75. end;
  76.  
  77. begin
  78.   grafinit; {initialize graphics adapter}
  79.   main;
  80. end.